package web;

import entity.Client;
import org.apache.commons.beanutils.BeanUtils;
import service.BuyService;
import service.ClientService;
import service.impl.BuyServiceImpl;
import service.impl.ClientServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;

/**
 * @author zy
 * @create 2021/12/5 15:16
 */
@WebServlet("/AddBuyList")
public class AddBuyList extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("UTF-8");
        String cid = request.getParameter("cid");
        String sum = request.getParameter("sum");
        BuyService buyService = new BuyServiceImpl();
        buyService.addBuyList(Integer.valueOf(cid),Integer.valueOf(sum));


        response.sendRedirect(request.getContextPath() + "/BuyListServlet");


    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request, response);
    }
}
